<script setup lang="ts">
import { inject } from "vue";
import * as injectKeys from "@/services/injectKeys";
import { ButtonComponent } from "@/models/component";

const props = defineProps<{ model: ButtonComponent }>();
const model = props.model;

const actionsService = inject(injectKeys.actionsServiceKey)!;

function onclick() {
  if (model.action) {
    actionsService.run(model.action.id, model.action.name);
  }
}
</script>

<template>
  <q-btn dense color="primary" v-bind="model.props" @click="onclick" />
</template>

<style scoped lang="less"></style>
